<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateChatGroupSessionAppraiseTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('chat_group_session_appraise', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('sessionId')->default(0)->comment('会话id');
            $table->unsignedInteger('groupId')->default(0)->comment('群id');
            $table->unsignedInteger('shopId')->default(0)->comment('门店Id');
            $table->tinyInteger('score')->default(0)->comment('评分 0未评分 1-5分');
            $table->tinyInteger('solve')->default(0)->comment('是否解决 0未填 1是 2否');
            $table->unsignedInteger('uid')->default(0)->comment('评价人id');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '群聊 - 会话评价';

            $table->index('sessionId', 'idx_sessionId');
            $table->index('shopId', 'idx_shopId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('chat_group_session_appraise');
    }
}
